#pragma once

#include <QString>

#pragma pack(push)
#pragma pack(1)
typedef struct _data
{
	char 		userName[30];
	unsigned	ip;
	char		mac[18];
	enum class Operaction
	{
		CmccOpen = 0x00010000 ,
		CmccClose = 0x01010000 ,
        UnioncomOpen = 0x00020000 ,
        UnioncomClose = 0x01020000 ,
        TelecomOpen = 0x00030000 ,
        TelecomClose = 0x01030000 ,
	}operaction;
	unsigned	checksum;
}Data;

#pragma pack(pop)

QString &correctMac ( QString &m );
bool isIpclientMac ( const QString &mac );
int checkSum ( const Data &data );
bool openDoor ( const QString &ip , const QString &mac, Data::Operaction operaction = Data::Operaction::CmccOpen );
